// window.onerror = function(msg, url, line, col, error) {
//     clearInterval(fmj.updateInterval);
//     alert(msg + " at " + line);
//     return false;
// };

window.onerror = function(msg) {
    if (fmj) { //rpg全局对象
        clearInterval(fmj.updateInterval);
    }

    alert('抱歉，游戏出现异常，我们将会尽快修复，感谢您的支持！')
    let data = JSON.stringify({
        msg: msg.message,
    })
    console.log('error handle', msg)
    $.ajax({
        // headers: {
        //     'Content-Type': 'application/json'
        // },
        method: 'POST',
        dataType: 'json',
        url: "http://airbox.qryoga.com/api/v1/game/error",
        data: {
            game_id: window.CurrGameId,
            data: data
        },
        success: function(msg) {
            window.location.href = "/index.html";
        },
        error: function(e) {
            alert('错误上报失败')
            window.location.href = "/index.html";
        }
    });
    return false;
};